package com.xm.xmds1705083.web.controller;

import com.xm.xm.dto.ResultDto;
import com.xm.xm.dto.SearchDto;
import com.xm.xmds1705083.service.service.DuoduoSpaceCollectionService;
import com.xm.xmds1705083.web.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 杭州新苗网络科技有限公司
 *
 * @author meihf
 * @create 2017/6/15
 * @description
 */
@Controller
@RequestMapping("/spaceCollection")
public class SpaceCollectionController extends BaseController{

    @Autowired
    DuoduoSpaceCollectionService duoduoSpaceCollectionService;

    /**
     * 添加收藏
     * @param searchDto
     * @return
     */
    @RequestMapping("/save")
    @ResponseBody
    public ResultDto save(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return duoduoSpaceCollectionService.save(searchDto);
    }

    /**
     * 我的收藏
     * @param searchDto
     * @return
     */
    @ResponseBody
    @RequestMapping("/findMyCollections")
    public ResultDto findMyCollections(@RequestBody SearchDto searchDto){
        searchDto.setAppUserId(getUserId());
        return duoduoSpaceCollectionService.findMyCollections(searchDto);
    }

}
